/****** 弹层对象 ******/
;var ebankLayer = {
		/**
		 * 弹出水波纹加载层
		 */
		showLoading:function(){
 			$("body").append('<div id="loadShadeLayer" class="wave-shadeCover"></div>' +
					'<div class="rotation"></div> ' +
					'<div class="wave">' +
					'<div class="waveCover"></div>' +
			'</div>');
		},
		/**
		 * 移除加载层
		 */
		dismissLoading:function(){
 			$(".wave-shadeCover").remove();
			$(".rotation").remove();
			$(".wave").remove();
		},

		/**
		 * 强提示框
		 *
		 * @param      {string}  msg     提示信息
		 */
		showInfo:function(msg){
			$('body').append('<div id="shadeLayer" class="shadeCover">' +
					'</div><div class="pop" id="pop_dialogue">' +
					'<p class="reminding"><span class="warm_icon"></span>温馨提示</p><i class="close" onclick="closeLayer()"></i>' +
					'<div class="warm_text">' +
					'<div id="warm_text_info" class="warm-text-info">' + msg + '</div>' +
					'<div class="h20"></div>' +
					'<div style="text-align:center">' +
					'<button class="btn_one" onclick="closeLayer()">我知道了' + 
					'</button>' +
					'</div>' +
					'</div>' +
			'</div>');
		},

		/**
		 * 确认提示框
		 *
		 * @param      {string}  contentText  提示框正文内容
		 * @param      {string}  sureText     确定按钮的文本内容
		 * @param      {string}  sureFuc      确定按钮触发时间的方法名（eg:function test(){},则填"test")
		 */
		showConfirm:function(contentText,sureText,sureFuc){
			$('body').append('<div id="shadeLayer" class="shadeCover">' +
					'</div><div class="pop" id="pop_dialogue">' +
					'<p class="reminding"><span class="warm_icon"></span>温馨提示</p><i class="close" onclick="closeLayer()"></i>' +
					'<div class="warm_text">' +
					'<div id="warm_text_info" class="warm-text-info">' + contentText + '</div>' +
					'<div class="h20"></div>' +
					'<div class="btns_two" style="text-align:center;">' +
					'<button href="#" onclick="closeLayer()" class="warm_btn1">取消</button>' +
					'<button id="myClose" onclick="' + sureFuc +'()" class="warm_btn2">' + sureText + '</button>' +
					'</div>' +
					'</div>' +
			'</div>');
		},

		/**
		 * 弹出弱提示
		 *
		 * @param      {string}  text    提示文本
		 */
		showMsg:function(text){
			//如果存在弱提示，则不显示
			if (document.getElementById("#toast")) {
				return;
			}
			$("body").append('<div id="toast" class="toast">' + text + '</div>');
			$toast = $("#toast");
			//设置弱提示框的top
			var screenWith = window.screen.availWidth;
			var toastWidth = $toast.width();
			var horizontalPadding = 25 + 25;
			var left = (screenWith - toastWidth - horizontalPadding) / screenWith / 2 * 100;
			//设置最小的margin:2%
			$toast.css("left",left+"%");
			//设置弱提示框的left
			var screenHeight = window.screen.availHeight;
			var toastHeight = $toast.height();
			var verticalPadding = 12 + 12;
			var top = (screenHeight - toastHeight - verticalPadding) / screenHeight / 2 * 100;
			$toast.css("top",top+"%");
			//提示框展示3500ms
			var showTime = 3500;
			var dismissDuration = 250;//提示框消失动画所花时间(/ms)
			setTimeout(function(){
				$toast.css("animation","bounceOut " + dismissDuration/1000 +"s linear forwards");
				setTimeout(function(){
					$toast.remove();
				},dismissDuration);
			},showTime)
		}
}

/**
 * 关闭弹框层
 */
function closeLayer(){
	var dismissDuration = 250;//消失动画所花时间(/ms)
	//添加消失的动画
	$("#pop_dialogue").css("animation","shakeToHide " + dismissDuration/1000 +"s linear forwards");
	$("#pop_dialogue").css("-webkit-animation","shakeToHide " + dismissDuration/1000 +"s linear forwards");
	//动画结束后消失
	setTimeout(function(){
		$('#pop_dialogue').remove();
		$('#shadeLayer').remove();
	},dismissDuration);
};

/**
 * 移动端禁掉页面拖拽
 */
function disableDrag() {
	$("body").bind("touchmove",function(event){
		event.preventDefault();
	});
}

/**
 * 移动端允许页面拖拽
 */
function enableDrag() {
	$("body").unbind("touchmove");
}
